//package cn.liukuan.jps.redis;
//
//import org.apache.lucene.store.AlreadyClosedException;
//import org.apache.lucene.store.Directory;
//import org.apache.lucene.store.Lock;
//import org.apache.lucene.store.LockFactory;
//
//import java.io.IOException;
//import java.io.Serializable;
//
///**
// * Created by liukuan on 16/5/30.
// */
//public abstract class RedisRAMBaseDirectory extends Directory implements Serializable {
//
//    volatile protected boolean isOpen = true;
//
//    /** Holds the LockFactory instance (implements locking for
//     * this Directory instance). */
//    protected final LockFactory lockFactory;
//
//    /** Sole constructor. */
//    protected RedisRAMBaseDirectory(LockFactory lockFactory) {
//        super();
//        if (lockFactory == null) {
//            throw new NullPointerException("LockFactory cannot be null, use an explicit instance!");
//        }
//        this.lockFactory = lockFactory;
//    }
//
//    @Override
//    public final Lock obtainLock(String name) throws IOException {
//        return lockFactory.obtainLock(this, name);
//    }
//
//    @Override
//    protected final void ensureOpen() throws AlreadyClosedException {
//        if (!isOpen) {
//            throw new AlreadyClosedException("this Directory is closed");
//        }
//    }
//
//    @Override
//    public String toString() {
//        return super.toString()  + " lockFactory=" + lockFactory;
//    }
//}
